home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20021006-20030409
/
000295_fdc@columbia.edu_Thu Feb 13 15:22:07 EST 2003.msg
< prev
next >
Wrap
Text File
|
2003-04-08
|
3KB
|
83 lines
Article: 14092 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Dealing with '\' char in strings of file locations
Date: 13 Feb 2003 14:52:27 -0500
Organization: Columbia University
Lines: 66
Message-ID: <b2gt1r$jmj$1@watsol.cc.columbia.edu>
References: <a70f50e.0302121525.7922c8c3@posting.google.com>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1045165948 26759 128.59.39.139 (13 Feb 2003 19:52:28 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 13 Feb 2003 19:52:28 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14092
In article <a70f50e.0302121525.7922c8c3@posting.google.com>,
Wes <wesdog@hotmail.com> wrote:
: This is my first experience with Kermit... So far I like what I see.
: However, I do have a question.
:
: My problem is that I will be running a script from a workstation
: called "serverx". The script will log into a FTP server and download
: a text file containing a file path in UNC format on each line
: (\\serverx\share\dir\file.txt) which, by the way, references a file on
: the workstation "serverx" (the UNC path would translate into
: c:\share\dir\file.txt). If that file is located on the workstation
: kermit will upload the file to another FTP server and put it in the
: same sub directory (ftp://servery/dir/).
:
: Since the UNC format in the file has '\' in it, how do I deal with
: this sitution. Here is what I have so far... I am not really sure
: how to proceed. Any help would be great.
:
As you know, backslash is a distinguished character in the Kermit command
and scripting language, just as it is in many other scripting languages.
In all these languages, there is an unfortunate conflict with DOS pathnames
and UNCs. The situation is discussed in "Using C-Kermit" on page 48 and
greater length here:
http://www.columbia.edu/kermit/ckermit70.html#x1.11
: One more question, can somebody explain "recursive evaluation" to me?
:
Kermit has two kinds of user-defined scalar variables: The \%x kind
(which are evaluated recursively) and the \m(name) kind. The difference
comes into play when a variable's definition includes backslashes. Whenever
you refer to a recursively evaluated variable, it is evaluated, and then its
value is evaluated, and then that value is evaluated, etc, until done. To
illustrate:
define \%a one
define \%b two
define \%c \%a \%b three
echo \%c <-- recursive evaluation
one two three
define text \%a \%b three
echo \m(text) <-- one-level-deep evaluation
\%a \%b three
Obviously the intention of recursive evaluation is to handle variables
whose definitions refer to other variables. Therefore, this type of
variable should not be used to hold DOS pathnames or UNCs.
To handle the kind of situation you describe, use one-level-deep
(named) variables:
fopen /read \%c somefile
if fail ...
fread /line \%c line
if fail ...
and then refer to the line you have just read as \m(line). Alternatively
you can use \fdefinition() to evaluate \%x variables one level deep:
fopen /read \%c somefile
if fail ...
fread /line \%c \%a
if fail ...
echo \fdef(\%a)
- Frank